//
//  PaymentResultsTableViewCell.m
//  chongwu
//
//  Created by 隼目 on 2021/9/17.
//

#import "PaymentResultsTableViewCell.h"

@implementation PaymentResultsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)creatView{
    self.backgroundColor=[UIColor whiteColor];
    
    UIImageView *imageView=[UIImageView new];
    [self.contentView addSubview:imageView];
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(126*_mainHeight);
        make.centerX.mas_equalTo(0);
        make.width.height.mas_equalTo(164*_mainWidth);
    }];
    imageView.image=[UIImage imageNamed:@"icon"];
    
    UILabel *label=[UILabel new];
    [self.contentView addSubview:label];
    [label mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(imageView.mas_bottom).mas_equalTo(92*_mainHeight);
    }];
    [label layoutIfNeeded];
    label.text=@"支付处理中";
    label.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    label.textColor=rgba(47,47,47,1);
    
    UILabel *label2=[UILabel new];
    [self.contentView addSubview:label2];
    [label2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(label.mas_bottom).mas_equalTo(34*_mainHeight);
    }];
    [label2 layoutIfNeeded];
    label2.text=@"若支付失败，已付款会在1～2个工作日内原路返回";
    label2.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(30)];
    label2.textColor=rgba(153,153,153,1);
    
    
    UIButton *continueBtn=[UIButton new];
    [self.contentView addSubview:continueBtn];
    [continueBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(39*_mainWidth);
        make.width.mas_equalTo(_mainW-78*_mainWidth);
        make.top.mas_equalTo(label2.mas_bottom).mas_equalTo(109*_mainHeight);
        make.height.mas_equalTo(_mainHeight*87);
    }];
    [continueBtn setTitle:@"继续查询" forState:0];
    [continueBtn setTitleColor:rgba(250,100,0,1) forState:0];
    continueBtn.titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    [continueBtn layoutIfNeeded];
    continueBtn.layer.masksToBounds=YES;
    continueBtn.layer.cornerRadius=87*_mainHeight/2;
    continueBtn.layer.borderColor=rgba(250,100,0,1).CGColor;
    continueBtn.layer.borderWidth=2*_mainWidth;
//    [continueBtn addTarget:self action:@selector(selectSubmitBtn) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *submitBtn=[UIButton new];
    [self.contentView addSubview:submitBtn];
    [submitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(39*_mainWidth);
        make.width.mas_equalTo(_mainW-78*_mainWidth);
        make.top.mas_equalTo(continueBtn.mas_bottom).mas_equalTo(40*_mainHeight);
        make.height.mas_equalTo(_mainHeight*87);
    }];
    [submitBtn setTitle:@"关闭页面" forState:0];
    [submitBtn setTitleColor:[UIColor whiteColor] forState:0];
    submitBtn.titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(36)];
    [submitBtn layoutIfNeeded];
    submitBtn.layer.masksToBounds=YES;
    submitBtn.layer.cornerRadius=87*_mainHeight/2;
    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = submitBtn.bounds;
    //将CAGradientlayer对象添加在我们要设置背景色的视图的layer层
    [submitBtn.layer insertSublayer:gradientLayer atIndex:0];
    //设置渐变区域的起始和终止位置（范围为0-1）
    gradientLayer.startPoint = CGPointMake(0, 1);
    gradientLayer.endPoint = CGPointMake(1, 1);
    gradientLayer.colors = @[(__bridge id)rgba(255,159,0,1).CGColor,
                             (__bridge id)rgba(255,116,0,1).CGColor ,
                             (__bridge id)rgba(255,102,0,1).CGColor];
    //设置颜色分割点（范围：0-1）
    gradientLayer.locations = @[@(0),@(0.5), @(1.0f)];
    submitBtn.layer.shadowColor = rgba(196,50,0,0.36).CGColor;
    submitBtn.layer.shadowOffset = CGSizeMake(0,0);
    submitBtn.layer.shadowOpacity = 1;
    submitBtn.layer.shadowRadius = 4;
//    [submitBtn addTarget:self action:@selector(selectSubmitBtn) forControlEvents:UIControlEventTouchUpInside];
    
    
    
}
@end
